<template>
  <div class="mod-config">
    <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
      <el-form-item>
        <el-input v-model="dataForm.key" placeholder="参数名xxx" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="getDataList()">查询</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="dataList"
      border
      v-loading="dataListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50">
      </el-table-column>
      <el-table-column
        prop="waiguaInfoId"
        header-align="center"
        align="center"
        label="主键">
      </el-table-column>
      <el-table-column
        prop="waiguaUsername"
        header-align="center"
        align="center"
        label="外挂账号">
      </el-table-column>
      <el-table-column
        prop="waiguaGrade"
        header-align="center"
        align="center"
        label="账号等级">
      </el-table-column>
      <el-table-column
        prop="reportuserName"
        header-align="center"
        align="center"
        label="举报用户名称">
      </el-table-column>
       <el-table-column
        prop="waiguaDescribe"
        header-align="center"
        align="center"
        label="描述">
      </el-table-column>
      <el-table-column
        prop="reviewStatus"
        header-align="center"
        align="center"
        label="视频状态">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.reviewStatus === 0" size="small" type="info">待审核</el-tag>
          <el-tag v-if="scope.row.reviewStatus === 1" size="small" >审核中</el-tag>
          <el-tag v-if="scope.row.reviewStatus === 2" size="small" type="success">审核完成</el-tag>
          <el-tag v-if="scope.row.reviewStatus === 3" size="small" type="danger">驳回</el-tag>
        </template>
      </el-table-column>
    
      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="150"
        label="操作">
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="reviewVideoHandle(scope.row.waiguaInfoId)">查看视频</el-button>
          <el-button type="text" size="small" @click="reviewUpdateHandle(scope.row.waiguaInfoId)">审核</el-button> 
        </template>
      </el-table-column>
    </el-table>
   
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
    <!-- 弹窗, 审核 -->
    <unmber-review-update v-if="reviewUpdateVisible" ref="reviewUpdate" @refreshDataList="getDataList"></unmber-review-update>
    <!-- 查看视频 -->
    <unmber-review-video  v-if="reviewVideoVisible" ref="reviewVideo" ></unmber-review-video>
  </div>
</template>

<script>
import UnmberReviewUpdate from './unmber-review-update.vue'
import UnmberReviewVideo from './unmber-review-video.vue'
  export default {
    data () {
      return {
        dataForm: {
          key: ''
        },
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        dataListSelections: [],
        reviewUpdateVisible: false,
        reviewVideoVisible: false
      }
    },
    components: {
        UnmberReviewUpdate,
        UnmberReviewVideo
    },
    activated () {
      this.getDataList()
    },
    methods: {
      //审核状态
      handleCommand(command,id) {
        this.$message('click on item ' + command+'==='+id);
      },
      // 获取数据列表
      getDataList () {
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl(`/waiguagg/info/listReview/0`),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex,
            'limit': this.pageSize,
            'key': this.dataForm.key
          })
        }).then(({data}) => {
          console.log("data",data);
          if (data && data.code === 0) {
            this.dataList = data.page.list
            this.totalPage = data.page.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      },
      // 查看视频
      reviewVideoHandle (id) {
        this.reviewVideoVisible = true
        this.$nextTick(() => {
          this.$refs.reviewVideo.init(id);
        })
      },
      // 审核
      reviewUpdateHandle (id) {
        this.reviewUpdateVisible = true
        this.$nextTick(() => {
          this.$refs.reviewUpdate.init(id)
        })
      }
    }
  }
</script>
 <style>
  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }
  .el-icon-arrow-down {
    font-size: 10px;
  }
</style>